package com.example.order.utils;


import com.example.order.Vo.ResponseVo;
import com.example.order.enums.ResponseEnum;

/**
 * @description:
 * @author: sanjin
 * @date: 2019/4/2 20:41
 */
public class ResponseVoUtils {
    public static ResponseVo success(Object data) {
        ResponseVo responseVo = new ResponseVo();
        responseVo.setCode(ResponseEnum.OK.getCode());
        responseVo.setMessage(ResponseEnum.OK.getMessage());
        responseVo.setData(data);
        return responseVo;
    }

    public static ResponseVo success() {
        return success(null);
    }

    public static ResponseVo errorMessage(String message) {
        ResponseVo responseVo = new ResponseVo();
        responseVo.setCode(ResponseEnum.ERROR.getCode());
        responseVo.setMessage(message);
        responseVo.setData(null);
        return responseVo;
    }
}
